package com.auxteam.elope;

import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.view.Menu;
import android.widget.VideoView;

public class VideoSplashActivity extends Activity implements OnCompletionListener{

	VideoView splashVideo;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
		setContentView(R.layout.activity_video_splash);
		
		splashVideo = (VideoView) findViewById(R.id.splashVideo);
		splashVideo.setVideoURI(Uri.parse("android.resource://" + getPackageName() +"/" + R.raw.colored_elearning));
		splashVideo.start();
		
		splashVideo.setOnCompletionListener(this);
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.video_splash, menu);
		return true;
	}

	@Override
	public void onCompletion(MediaPlayer mp) {
		startActivity(new Intent(getApplicationContext(), WelcomeMenu.class));
		finish();
		
	}

}
